import redis
import logging
class Config(object):
    """项目配置类"""
    DEBUG = True
    SECRET_KEY = '!@#%^%^DFFGHGSD@#%^'

    # 数据库相关配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@192.168.59.132:3306/gz02_info'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis数据库的相关配置
    REDIS_HOST = '192.168.59.132'
    REDIS_PORT = 6379

    SESSION_TYPE = 'redis'

    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER=True
    RERMANENT_SESSION_LIFETIME=24*3600*2


class DevelopmentConfig(Config):
    """开发环境中的配置类"""
    DEBUG = True
    #开发环境中的日志等级
    LOG_LEVEL=logging.DEBUG


class ProductionConfig(Config):
    """生产环境(线上)中配置类"""
    # 配置生产环境中使用的配置类
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@192.168.59.132:3306/info'
    LOG_LEVEL = logging.WARNING


config_dict={
    'development':DevelopmentConfig,
    'production':ProductionConfig
}